import request from "@/utils/request";
import { AxiosPromise } from "axios";
import {SysLazyToolUserForm, SysLazyToolUserQuery} from "@/api/lazyToolUser/types";

/**
* 懒人秘笈用户信息表数据
*
* @param queryParams
*/
export function getSysLazyToolUserPage(
queryParams: SysLazyToolUserQuery
): AxiosPromise<PageResult<[]>> {
return request({
url: '/api/v1/lazyToolUser/page',
method: 'get',
params: queryParams
});
}


/**
* 获取懒人秘笈用户信息表表单数据
*
* @param queryParams
*/
export function getSysLazyToolUserForm(id: number): AxiosPromise<SysLazyToolUserForm> {
    return request({
    url: '/api/v1/lazyToolUser/' + id + '/form',
    method: 'get'
    });
    }

    /**
    * 保存懒人秘笈用户信息表
    *
    * @param data
    */
    export function saveSysLazyToolUser(data: SysLazyToolUserForm) {
    return request({
    url: "/api/v1/lazyToolUser",
    method: "post",
    data: data,
    });
    }

    /**
    * 删除懒人秘笈用户信息表
    *
    * @param ids
    */
    export function deleteSysLazyToolUser(ids: string) {
        return request({
        url: '/api/v1/lazyToolUser/' + ids,
        method: 'delete'
        });
    }

    /**
    * 导入懒人秘笈用户信息表
    *
    * @param file
    */
    export function importSysLazyToolUser(file: any) {
        const formData = new FormData();
        formData.append('file', file);
        return request({
            url: '/api/v1/lazyToolUser/sysLazyToolUserImport',
            method: 'post',
            data: formData,
            headers: {
                'Content-Type': 'multipart/form-data'
            }
        });
    }

    /**
    * 导出懒人秘笈用户信息表
    *
    * @param ids
    * @returns
    */
    export function exportSysLazyToolUser(ids: any) {
        return request({
            url: '/api/v1/lazyToolUser/_export?ids='+ids,
            method: 'get',
            responseType: 'arraybuffer'
        });
    }

/**
 * 把普通用户变成测试用户
 *
 * @param id
 */
export function changeStatus(id: any) {
	return request({
		url: '/api/v1/lazyToolUser/changeStatus/' + id,
		method: 'get'
	});
}

/**
 * 把普通用户变成测试用户
 *
 * @param id
 */
export function changeUserStatus(id: any) {
	return request({
		url: '/api/v1/lazyToolUser/changeUserStatus/' + id,
		method: 'post'
	});
}

/**
 * 查看密码
 *
 * @param id
 */
export function getPwd(id: any) {
	return request({
		url: '/api/v1/lazyToolUser/getPwd/' + id,
		method: 'post'
	});
}
